function test() {
    var food = 'apple'

    function a() {
        // console.log(food);
        food = 'banana'
    }

    function b() {
        console.log(food);
    }

}

// a()
// b()//输出banana     //但是如果这里是b()   a()  则输出apple


function fruit() {
    var food = 'apple'
    var obj = {
        eatFood:function () {
            if(food!==''){
                console.log('I am eating'+food);
                food = ''
            }else{
                console.log('There is noting');
            }
        },
        pushFood:function () {
            food = 'banana'
        }
    }
}
